import React from 'react'
import { Outlet, useNavigate } from 'react-router-dom'

export default function Home() {

  const navigate = useNavigate()

  const messageBtnHandler = () => {
    navigate('/main/home/message?id=001&username=tom')
  }

  const newsBtnHandler = () => {
    navigate('/main/home/news?id=002&username=jerry')
  }

  return (
    <div>
      <h3>我是Home的内容</h3>
      <button onClick={messageBtnHandler}>message</button>
      <button onClick={newsBtnHandler}>news</button>
      {/* 子级路由占位组件 */}
      <Outlet />
    </div>
  )
}
